import { useEffect } from "react"
import { useForm } from "react-hook-form"
import User from "./system/User"

export default function Reg(){

  const { register, handleSubmit,setValue,reset } = useForm()

  const onSubmit = handleSubmit(data => {
    console.log(data)
  })

  useEffect(()=>{

    //调接口
    let data={userName:'ldq',password:'9999'};

    reset(data);

    // setValue('userName','admin');
    // setValue('password','8888');

  },[])

   
 

  return(
      <form onSubmit={onSubmit}>
      <div>修改资料</div>
      <div>账号<input {...register('userName')} type="text" /></div>
      <div>密码<input {...register('password')} type="password" /></div>
      <div><button type="submit">注册</button></div>
      </form>
  )
}